package org.llc.user.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.llc.common.model.UserInfoDTO;
import org.llc.common.model.Result;
import org.llc.user.entity.UserInfo;
import org.llc.user.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 *  用户信息控制器
 *
 * @author llc
 * @date 2021-04-18
 * @since 1.0.0
 */
@Api(tags = "用户信息" )
@RestController
@RequestMapping("/userInfo")
public class UserInfoController {


    @Autowired
    private UserInfoService userInfoService;


    @ApiOperation(value = "用户基础信息初始化")
    @PostMapping("/unAuthenticated/initialize")
    public Result initialize(@Valid @RequestBody UserInfoDTO reqUserInfoInitializeDTO){
        return userInfoService.init(reqUserInfoInitializeDTO);
    }

    @ApiOperation(value = "用户列表")
    @GetMapping("/list")
    public Result list(){
        List<UserInfo> result = userInfoService.list();
        return Result.succeed(result);
    }

}
